Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Add refs endpoint #147

Merged
merged 42 commits into from
Apr 16, 2020
Merged

Add refs endpoint #147

merged 42 commits into from
Apr 16, 2020

Conversation

koivunej
Copy link
Collaborator

@koivunej koivunej commented Apr 7, 2020

Builds on #137 and later #155

TODO:

I'll be rebasing and probably separating the needless mut removal, which is probably a clippy issue why that wasn't picked up. Apparently the clippy or the compiler don't support linting on this at the moment.

@koivunej
Copy link
Collaborator Author

koivunej commented Apr 7, 2020

Build fails because using go-ipfs compatible dag-cbor requires ipld/libipld#30 and thus using the same relative path rust-ipld.

src/repo/mod.rs Outdated Show resolved Hide resolved
http/src/v0/refs/format.rs Outdated Show resolved Hide resolved
http/src/v0/refs.rs Outdated Show resolved Hide resolved
http/src/v0/refs.rs Outdated Show resolved Hide resolved
http/src/v0/refs.rs Outdated Show resolved Hide resolved
Joonas Koivunen added 18 commits April 15, 2020 16:55
at least the test case seems to work, now left is pretty much mapping
the options and the path handling.
accidentially commited a dangling closing brace.
still need to figure out the Send + Sync + 'static bound, issue is with
Sync, which might come from the refs used, get_block(&cid)..
this required some unsafety to be able to present the Stream as Send +
Sync + 'static as required by hyper. not 100% sure if that pin_project
is ok to do, but the only interfaces exposed are callable as futures so
it shouldn't be too bad.
this is required to have multiple paths.
I had not originally noticed that we need to do the walk from multiple
paths.
Joonas Koivunen added 11 commits April 15, 2020 16:55
originally it was easier to write everything to the same file, but it
gets difficult to read after 1000 lines. while reorganising stuff into
more tight modules, some direct calls were changed not to be needed,
like RefsOptions creating the EdgeFormatter; the EdgeFormatter is not
created in the refs function itself.

chopped off parts:

 * RefsOptions stuff to refs/options.rs
 * EdgeFormatter and the string format to refs/format.rs
 * Unshared to refs/unshared.rs
 * HandledErr StreamResponse to refs/support.rs
the situation is not good, as it would make sense to re-export libipld
from ipfs as parts are already re-exported but with strange names.
kept the return value as a stream. it'll at least save us the trouble of
concatenating all of the values into a big vector.
@koivunej koivunej marked this pull request as ready for review April 15, 2020 13:57
@koivunej
Copy link
Collaborator Author

Finally ready for review. I'll still try to collapse the commits to something more useful or write a squash message.

@aphelionz aphelionz linked an issue Apr 15, 2020 that may be closed by this pull request
@koivunej
Copy link
Collaborator Author

@aphelionz I added some test cases which will catch any changes in Ipld structure read from dag-pb on upgrade, and some path tests based on comments. Please reply if this is still approved and I'll squash with a pretty message.

@koivunej koivunej merged commit 79985e4 into rs-ipfs:master Apr 16, 2020
@koivunej koivunej deleted the add_refs_endpoint branch September 24, 2020 12:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for /refs endpoints
3 participants